import { stringify } from 'qs';
import request from '@/utils/request';

import webpath from '@/utils/webpath';

export async function deleteByPrimaryKeyForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/delete?${stringify(params)}`);
}

export async function selectByPrimaryKeyForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/get?${stringify(params)}`);
}


export async function insertForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}

export async function updateForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function deleteByMapForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/deleteByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete',
        },
    });
}

export async function updateByMapForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/updateByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function getOneForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/getOne`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function getAllForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function queryPageForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function countForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/count`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function insertBatchForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/insertBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}

export async function deleteBatchForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/deleteBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete',
        },
    });
}

export async function updateBatchForProUserOrgan(params = {}) {
    return request(`/${webpath}/web/api/service/userorgan/updateBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function getProOrgTreeByLevelCode(params = {}) {
    return request(`/${webpath}/web/api/service/proorg/getProOrgTreeByLevelCode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}
export async function getProOrgTreeByParentid(params = {}) {
    return request(`/${webpath}/web/api/service/proorg/getProOrgTreeByParentid`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}
export async function getPageProOrgByOrgCode(params = {}) {
    return request(`/${webpath}/web/api/service/proorg/getPageProOrgByOrgCode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function insertForProOrg(params = {}) {
    return request(`/${webpath}/web/api/service/proorg/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}


export async function updateForProOrg(params = {}) {
    return request(`/${webpath}/web/api/service/proorg/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function deleteByPrimaryKeyForProOrg(params = {}) {
    return request(`/${webpath}/web/api/service/proorg/delete?${stringify(params)}`);
}

export async function queryPageForProUser(params = {}) {
    return request(`/${webpath}/web/api/service/prouser/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function updateChangeTargetNodeWithSourceNodeForProOrg(params = {}) {
    return request(`/${webpath}/web/api/service/proorg/updateChangeTargetNodeWithSourceNodeForProOrg`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}